import json

import pandas


def load_json_test_data(jsonfile: str):
    with open(jsonfile, 'r', encoding="utf-8") as file:
        data = json.load(file)
        return ", ".join(data[0]), data[1:]


def load_test_cases_from_excel(file_path):
    df = pandas.read_excel(file_path)

    test_cases_dict = {}
    for index, row in df.iterrows():
        case_id = row['用例编号']
        test_cases_dict[case_id] = {
            '用例标题': row['用例标题'],
            '项目/模块': row['项目/模块'],
            '优先级': row['优先级'],
            '前置条件': row['前置条件'],
            '测试步骤': row['测试步骤'],
            '测试数据': row['测试数据'],
            '预期结果': row['预期结果']
        }

    return test_cases_dict

